#ifndef DATAMODEL_H
#define DATAMODEL_H
#include <QAbstractListModel>

#include <QObject>

class ItemListModelPrivate;
class DataModel : public QAbstractListModel
{
    Q_OBJECT
    Q_PROPERTY(QString sql READ sql WRITE setSql)
    Q_PROPERTY(QStringList columnNameList READ columnNameList WRITE setColumnNameList)
public:
    explicit DataModel(QObject *parent = 0);
    ~DataModel();

    int rowCount(const QModelIndex &parent) const;
    QVariant data(const QModelIndex &index, int role) const;
    QHash<int , QByteArray> roleNames() const;
    QString sql() const;
    void setSql(const QString &tbl);
    QStringList columnNameList() const;
    void setColumnNameList(const QStringList list);

    Q_INVOKABLE void InitialData(QString sql, QStringList list);


signals:

public slots:

private:
    QString m_sql;
    ItemListModelPrivate *m_dptr;
    QStringList m_ColumnName;
};

#endif // DATAMODEL_H
